//
//  Shop.m
//  Ghac 4S
//
//  Created by apple on 11-9-15.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import "Shop.h"
#import "KXMLNode.h"
#import <MapKit/MapKit.h>
@implementation Shop
@synthesize address;
@synthesize city;
@synthesize emergencyNum;
@synthesize fax;
@synthesize name;
@synthesize phone;
@synthesize shopId;
@synthesize location;
@synthesize province;

-(id)initWithNode:(KXMLNode *)node
{
    if ((self = [self init]))
    {
        self.address = [node valueForKeyPath:@"address.__nodeValue__"];
        self.city = [node valueForKeyPath:@"city.__nodeValue__"];
        self.emergencyNum = [node valueForKeyPath:@"emergencyNum.__nodeValue__"];
        self.fax = [node valueForKeyPath:@"fax.__nodeValue__"];
        self.name = [node valueForKeyPath:@"name.__nodeValue__"];
        self.phone = [node valueForKeyPath:@"phone.__nodeValue__"];
        self.shopId = [node valueForKeyPath:@"showId.__nodeValue__"];
        self.province = [node valueForKeyPath:@"province.__nodeValue__"];
        
       
        CLLocationDegrees latitude = [[node valueForKeyPath:@"latitude.__nodeValue__"] doubleValue];
        CLLocationDegrees longitude = [[node valueForKeyPath:@"longitude.__nodeValue__"] doubleValue];
//         NSLog(@"%@, %@, %f, %f,", [node valueForKeyPath:@"latitude.__nodeValue__"], [node valueForKeyPath:@"longitude.__nodeValue__"], latitude, longitude);
        location = CLLocationCoordinate2DMake(latitude, longitude);
    }
    return self;
}
-(NSString *)title
{
    return self.name;
}
-(NSString *)subtitle
{
    return self.address;
}
-(CLLocationCoordinate2D)coordinate
{
    return self.location;
}
-(void)dealloc
{
    self.address = Nil;
    self.city = Nil;
    self.emergencyNum = Nil;
    self.fax = Nil;
    self.name = Nil;
    self.phone = Nil;
    self.shopId = Nil;
    self.province = Nil;
    [super dealloc];
}

@end
